package VNF_DelayLBA_large;

public class Tool_Util {
	public int stringToInt(String ch){
		int k = Integer.valueOf(ch).intValue();
		return k ;
	}
	
	public int[] stringToIntArray(String string){
		int count = string.length();
		char[] char_1 = new char[count];
		int[] int_1 = new int[count];
		for (int i=0;i<count;i++){
			char_1[i] = string.charAt(i);
			String s = String.valueOf(char_1[i]);
			int_1[i] = Integer.valueOf(s).intValue();
		}
		return int_1 ;
	}
//	***************************************************************************************
//	���ߣ���������������е�link���������е�slotΪ״̬0����Ϊ����״̬
	public String setAttributeOfSituationOfSlots(int numberofallslot ){
			char[] situationofslot = new char[numberofallslot];
			for (int i=0;i<numberofallslot;i++){
				situationofslot[i] = '0';
			}
			String situationofslots = new String(situationofslot);
			return situationofslots;
		}
//	***************************************************************************************	
	public String setAttributeOfCapacityOfSlots(int numberofallslot, int startnumberofslot , int endtnumberofslot){
		char[] situationofslot = new char[numberofallslot];
		for (int i=0;i<startnumberofslot;i++){
			situationofslot[i] = '0';
		}
		for (int i=startnumberofslot;i<endtnumberofslot;i++){
			situationofslot[i] = '1';
		}
		for (int i=endtnumberofslot;i<numberofallslot;i++){
			situationofslot[i] = '0';
		}
		String situationofslots = new String(situationofslot);
		return situationofslots;
	}
	public String intArrayToString(int[] int_1){
		String s_1 = new String();
		for (int num : int_1){
			String s = String.valueOf(num);
			s_1 = s_1 + s ;
		}
		return s_1;
	}
}
